import React, { Component, View } from 'react-native';
import { Provider } from 'react-redux';
import Login from './pages/Login';

import configureStore from './configureStore';

export default class App extends Component {
  constructor() {
    super();
    this.state = {
      loading: true,
      store: configureStore(() => this.setState({ loading: false })),
    };
  }

  render() {
    const { loading, store } = this.state;
    if (loading) {
      return <View>Loading</View>;
    }
    return (
      <Provider store={store}>
        <Login />
      </Provider>
    );
  }
}
